Skip to main content

Request Log Tracing

In complex applications where many different processes interact to handle a request it can be difficult to trace the flow of data in the event of an error. One approach is to collect the logs emitted by the separate processes in a log aggregator such as ElasticSearch, Datadog, or Splunk. A unique request or trace id is passed between processes and any emitted logs contain this id. The id can be used to filter and group the logs.

All connection, query, info, and save methods in MVOM accept an optional property called requestId. This value is sent to MVIS in a header called X-MVIS-Trace-Id. If a requestId is not provided MVOM will generate a UUID.

Below are some sample logs from MVIS with a request/trace id:

[X-MVIS-Trace-Id:ROOT: 479e88db-03e6-4229-a869-716ed61a6c1f] 2023-03-03 17:50:10:731 [qtp712627377-120766] ERROR com.rs.u2.u2rest.b.c - [account] U2DataStore: callSubroutine() 81015: The connection has timed out
[X-MVIS-Trace-Id:ROOT: 479e88db-03e6-4229-a869-716ed61a6c1f] 2023-03-03 17:50:10:731 [qtp712627377-120766] ERROR com.rs.u2.u2rest.b.c - Timeout occurred while processing request: Exception: Failed to complete calling a subroutine: mvom_entry@0.2.0 asjava.b.x: The connection has timed out.
info

Support for request/trace ids was introduced in MVIS 1.3.2. In earlier versions of MVIS the X-MVIS-Trace-Id header is ignored.

As explained in Detecting MVOM in Triggers, MVOM does not interact with your MultiValue Basic programs directly. However, writes to any files with triggers established will cause your trigger programs to run. If you would like to utilize the request id in your your trigger subroutines, you can declare your own /S$MVOM/ named common area:

COM /S$MVOM/ S$MVOM.PROCESS
COM /S$MVOM/ S$MVOM.USER1, S$MVOM.USER2, S$MVOM.USER3, S$MVOM.USER4, S$MVOM.USER5
COM /S$MVOM/ S$REQUEST.ID

S$REQUEST.ID will be set to the value of requestId either autogenerated or provided to any MVOM connection, info, query, or save method. By utilizing a request id, logs emitted by your application, MVIS, and trigger subroutines can be grouped together.

Related: Detecting MVOM in Triggers